<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class foliosheet extends CI_Controller 
	{
			public function worklist()
			{
			echo  $this->foliosheet_model->getWorklist();
			}
			public function getDataFolioSheet()
			{
			 	$inputData = array(
					"form_id"=>"3",
					"type_of"=>$this->input->post("foliosheetFS1"),
					"gram"=>$this->input->post("foliosheetFS2"),
					"grade"=>$this->input->post("foliosheetFS3"),
					//"problem "=>$this->input->post("foliosheetFS4"),
					"size"=>$this->input->post("foliosheetFS5"),
					"lot_no"=>$this->input->post("foliosheetFS6"),
					"position"=>$this->input->post("foliosheetFS7"),
					"sorter"=>$this->input->post("foliosheetFS8"),
					"shift"=>$this->input->post("foliosheetFS9")
					//"modify_user"=> '10001',
					//"status"=> '1'
				);
			 	$text = "";
			 	$inputAllData=array();
			 	for($i=12;$i<=28;$i++){
				$data= array();
				$data = array(
			 	"data_name"=> "foliosheetFS".$i,
			 	"data_value"=> $this->input->post("foliosheetFS".$i."_1"),
			 	//"value_end"=> $this->input->post("finalcheckFC".$i."_2")
			 	);
			 	$inputAllData[]=$data;
			 	}
				//print_r($inputAllData);
				print_r( $this->foliosheet_model->keyInFolioSheet($inputData,$inputAllData));
				//echo $this->finalcheck_model->checkFinalCheck($inputData,$inputAllData);

			}
			public function newDataFolioSheet()
			{
			 	$inputData = array(
					"form_id"=>"3",
					"type_of"=>$this->input->post("foliosheetFS1"),
					"gram"=>$this->input->post("foliosheetFS2"),
					"grade"=>$this->input->post("foliosheetFS3"),
					"size"=>$this->input->post("foliosheetFS5"),
					"lot_no"=>$this->input->post("foliosheetFS6"),
					"position"=>$this->input->post("foliosheetFS7"),
					"sorter"=>$this->input->post("foliosheetFS8"),
					"shift"=>$this->input->post("foliosheetFS9"),
					"start_date"=>$this->input->post("foliosheetFS10"),
					"end_date"=>$this->input->post("foliosheetFS11"),
					"modify_user"=>$this->session->userdata('user_id'),
					"status"=> '1'
				);
			 	$text = "";
			 	$inputAllData=array();
			 	for($i=12;$i<=28;$i++){
				$data= array();
				$data = array(
			 	"data_name"=> "foliosheetFS".$i,
			 	"value_start"=> $this->input->post("foliosheetFS".$i."_1"),
			 	"value_end"=> $this->input->post("foliosheetFS".$i."_2")
			 	);
			 	$inputAllData[]=$data;
			 	}
				//print_r ($inputAllData);
				echo $this->foliosheet_model->checkFolioSheet($inputData,$inputAllData);

			}
		public function detail_foliosheet()
		{
			$t_id = $this->uri->segment(3);
			$data['rs1']=$this->foliosheet_model->detail_foliosheet1($t_id);
			$data['rs2']=$this->foliosheet_model->detail_foliosheet2($t_id);
			//print_r ($data['rs']);
			$this->load->view('template/template');
			$this->load->view("detail/FolioSheet",$data);
			$this->load->view('template/footer');
		}
		public function information_foliosheet()
		{
			$mt_id = $this->uri->segment(3);
			$data['rs1']=$this->foliosheet_model->information_foliosheet1($mt_id);
			$data['rs2']=$this->foliosheet_model->information_foliosheet2($mt_id);
			//print_r ($data['rs']);
			$this->load->view('template/template');
			$this->load->view("information/FolioSheet",$data);
			$this->load->view('template/footer');
		}
	}
